package com.wedo.mall.adapter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.e.library.adapter.Adapter;
import com.wedo.mall.R;
import com.wedo.mall.entity.Category;

import java.util.List;

/**
 * Created by lxy on 2017/6/10.
 */
public class CategoryAdapter extends Adapter<Category> {

    public CategoryAdapter(Context context, List<Category> datas) {
        super(context, datas);
    }

    @Override
    protected int layout() {
        return R.layout.item_category;
    }

    @Override
    protected void bind(EHolder holder, Category category, int position) {
        ImageView iv_icon = holder.find(R.id.iv_icon);
        TextView tv_name = holder.find(R.id.tv_name);
        tv_name.setText(category.name);
        Glide.with(mContext).fromResource().load(category.icon).into(iv_icon);
    }
}
